﻿using SalesSys.DAL.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace SalesSys.Site.Models.Phone
{
    public class ProviderDto
    { /// <summary>
        /// 供应商类型
        /// </summary>
        public ProviderType ProviderType { get; set; }

        /// <summary>
        /// 名称
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// 地址
        /// </summary>
        public Guid DistrictId { get; set; }

        /// <summary>
        /// 先款优惠
        /// </summary>
        public decimal FullPaymentDiscount { get; set; }

        /// <summary>
        /// 非标优惠数
        /// </summary>
        public decimal NonstandardDiscount { get; set; }

        /// <summary>
        /// 采购非标优惠金额,用于统一分析进销成本
        /// </summary>
        public decimal PurchasingNonstandard { get; set; }

        /// <summary>
        /// 地址
        /// </summary>
        public string Address { get; set; }

        /// <summary>
        /// 非标优惠特例，供应商id=优惠；供应商id=优惠；
        /// </summary>
        public string NonstandardDiscountCase { get; set; }

        /// <summary>
        /// 仓库商品
        /// </summary>
        public ICollection<DepotCommodity> DepotCommoditys { get; set; }

        /// <summary>
        /// 钢厂
        /// </summary>
        public Guid SupplierId { get; set; }
        /// <summary>
        /// 区域经理
        /// </summary>
        public Guid ManagerId { get; set; }
        /// <summary>
        /// 运营人员
        /// </summary>
        public Guid OperationsManId { get; set; }

        /// <summary>
        /// 是否非标
        /// </summary>
        public bool IsNonStandard { get; set; }

        /// <summary>
        /// 主要驻厂人员
        /// </summary>
        public virtual Guid MainFieldManId { get; set; }

        /// <summary>
        /// 只存数值，具体对象都要重新读取
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public Provider ToEntity(Provider entity = null)
        {
            if (entity == null)
            {
                entity = new Provider();
            }
            entity.ProviderType = ProviderType;
            entity.Name = Name;
            entity.FullPaymentDiscount = FullPaymentDiscount;
            entity.NonstandardDiscount = NonstandardDiscount;
            entity.PurchasingNonstandard = PurchasingNonstandard;
            entity.Address = Address;
            entity.NonstandardDiscountCase = NonstandardDiscountCase;
            entity.IsNonStandard = IsNonStandard;
            return entity;
        }
    }
}